package com.fishery.order.service.client;

import com.fishery.entity.Result;
import com.fishery.order.entity.client.ProductInventoryVo;
import com.fishery.order.handler.BaseClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author ghost
 * @since 2021/2/1 11:24
 */
@FeignClient(value = "fishery-base-service", fallback = BaseClientFallback.class)
public interface BaseClient {

	/**
	 * 根据基地id获取基地信息
	 *
	 * @param baseId
	 * @return
	 */
	@GetMapping("/base/{id}")
	public Result getBaseById(@PathVariable(value = "id") String baseId);

	/**
	 * 减少库存量
	 *
	 * @param productInventoryVo
	 * @return
	 */
	@PutMapping("/base/product/order/decrease")
	public Result decreaseAmountAndWeightOfRecord(@RequestBody ProductInventoryVo productInventoryVo);

	/**
	 * 增加库存量
	 *
	 * @param productInventoryVo
	 * @return
	 */
	@PutMapping("/base/product/order/increase")
	public Result increaseAmountAndWeightOfRecord(@RequestBody ProductInventoryVo productInventoryVo);


	/**
	 * 溯源水产品信息
	 *
	 * @param productId
	 * @return
	 */
	@GetMapping("/base/trace/{productId}/{size}/{current}")
	public Result traceInformationOfProduct(@PathVariable(name = "productId", required = true) String productId,
											@PathVariable(name = "size", required = true) int size,
											@PathVariable(name = "current", required = true) int current);

	/**
	 * 溯源投入品信息
	 *
	 * @param supplyId
	 * @return
	 */
	@GetMapping("/base/trace/{supplyId}")
	public Result traceSupplyInformation(@PathVariable(name = "supplyId", required = true) String supplyId);

	/**
	 * 溯源更多到喂养信息
	 *
	 * @param farmingId
	 * @param size
	 * @param current
	 * @return
	 */
	@GetMapping("/base/trace/feeding/{farmingId}/{size}/{current}/{catchTime}")
	public Result traceMoreFeedingInformationOfProduct(@PathVariable(name = "farmingId", required = true) String farmingId,
													   @PathVariable(name = "size", required = true) int size,
													   @PathVariable(name = "current", required = true) int current,
													   @PathVariable(value = "catchTime", required = true) String catchTime);
}
